let express = require("express");
let cookie = require("cookie-parser");

let server = express();
server.listen("8080");

//server.use(cookieParser({}))
//加签名
server.use(cookie("secret",{signed:true}))

server.use("/a",(req,res,next)=>{
  //接收：
  //req.cookies
  //req.signedCookies
  console.log(req.cookies)
  console.log(req.signedCookies)//{ name: '123' }|{ name: 'false' }如果有篡改就变成false
  res.cookie("name","123")
  res.send("ok")
});
//decodeURIComponent("name=s%3A123.grJSVpu17ufVJYeqWc9s%2Bc79wLbPuSpFPMtGnHs%2Br94")
//name=s:123.grJSVpu17ufVJYeqWc9s+c79wLbPuSpFPMtGnHs+r94
//静态文件
server.use(express.static("./webapps/"));